//配置路由表
import React from "react";
import {Navigate} from 'react-router-dom'

let Layout = React.lazy(()=>import('../pages/Layout'))
let List = React.lazy(()=>import('../pages/list'))
let SwitchLang = React.lazy(()=>import('../pages/switchLang'))
let SwitchTheme = React.lazy(()=>import('../pages/switchTheme'))

//二级路由
export const secondRoutes = [
    {
        path:"/list",
        element:<List/>,
        title:'列表'
    },
     {
        path:"/switchLang",
        element:<SwitchLang/>,
        title:'切换中英文'
    },
     {
        path:"/switchTheme",
        element:<SwitchTheme/>,
        title:'切换主题颜色'
    }
]

//一级路由
const routes = [
    {
        path:"/",
        element:<Layout/>,
        children:[
            ...secondRoutes,
            //路由重定向
            {
                path:"/",
                element:<Navigate to='/list'></Navigate>
            }
        ]
    }
]

export default routes